#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
    ll n, k;
    cin >> n >> k;
    ll t = 1;
    int p = 1;
    while(t < k){
        p++;
        t = t + p;
    }
    int p1 = n - p, p2 = p1 + 1 + (t - k);
    for(int i = 1; i <= n; i++){
        if(i == p1 || i == p2){
            cout << 'b';
        }else{
            cout << 'a';
        }
    }
    cout << endl;

}

int main(){
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}